import request from '@/router/axios';

export const getPositionTree = (userId) => {
  return request({
    url: '/api/position/listPositions',
    method: 'post',
    params: {
      userId
    }
  })
}
export const getList = (page, size, params) => {
  return request({
    url: '/api/position/list',
    method: 'post',
    params: {
      ...params,
      page,
      size,
    }
  })
}
export const remove = (positionId) => {
  return request({
    url: '/api/position/delete',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      positionId,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/position/addItem',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/position/editItem?',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: row
  })
}

export const getPoistion = (positionId) => {
  return request({
    url: `/api/position/detail/`,
    method: 'post',
    data: {
      positionId
    }
  })
}

export const changeStatus = (positionId, status) => {
  return request({
    url: '/api/position/changeStatus',
    method: 'post',
    meta: {
      isSerialize: true,
    },
    data: {
      positionId,
      status
    }
  })
}